package com.deng.maintenance.item_weight.view
{
	import flash.display.Sprite;
	
	import mx.controls.DataGrid;

	public class ItemWeightDataGrid extends DataGrid
	{
		public var _rowColorFunction:Function;
  		public var _customed:Boolean;//是否自定义颜色设置
 		public var _customerColor:uint=0xfcf13e;//自定义颜色

		public function ItemWeightDataGrid()
		{
			super();
		}
		override protected function drawRowBackground(s:Sprite, rowIndex:int, 
													y:Number, height:Number, 
													color:uint, dataIndex:int):void{
			if (_customed==true){
    			if (this._rowColorFunction != null){
     				if (dataIndex < this.dataProvider.length){
      					var item:Object=this.dataProvider.getItemAt(dataIndex);//按指定行进行颜色设置
      					color=this._rowColorFunction.call(this, item, color);
     				}
    			}else{
	     			if (this._customerColor!=0){
	      				if (dataIndex < this.dataProvider.length){
	       					color=this._customerColor;
						}
					}
				}
   			}
   			super.drawRowBackground(s, rowIndex, y, height, color, dataIndex);
  		}
	}
}